import request from "@/router/axios";
export const getList = (page, size, params) => {
  return request({
    url: "/base/brand/list",
    method: "post",
    params: {
      ...params,
      page,
      size
    }
  });
};

export const remove = id => {
  return request({
    url: "/base/brand/delete",
    method: "post",
    meta: {
      isSerialize: true
    },
    data: {
      id
    }
  });
};

export const deletes = (ids) => {
    return request({
        url: '/base/brand/batchDelete',
        method: 'post',
        meta: {
            isSerialize: true,
        },
        data: {
            ids,
        }
    })
}

export const add = row => {
  return request({
    url: "/base/brand/addItem",
    method: "post",
    meta: {
      isSerialize: true
    },
    data: row
  });
};

export const addClassBrand = (brandId, goodsClassId) => {
  return request({
    url: "/base/classBrand/addItem",
    method: "post",
    meta: {
      isSerialize: true
    },
    data: {
      brandId,
      goodsClassId
    }
  });
};

export const update = row => {
  return request({
    url: "/base/brand/editItem",
    method: "post",
    meta: {
      isSerialize: true
    },
    data: row
  });
};

export const getUser = id => {
  return request({
    url: "/api/mgr/getUserInfo",
    method: "post",
    meta: {
      isSerialize: true
    },
    data: {
      id
    }
  });
};

export const approveBrand = (id, brandAudit) => {
  // 这里classDisplay如果是boolean类型,无法传入后台,待以后优化吧
  return request({
    url: "/base/brand/editItem",
    method: "post",
    meta: {
      isSerialize: true
    },
    data: {
      id,
      brandAudit
    }
  });
};

export const removeAll = (ids) => {
  // 这里classDisplay如果是boolean类型,无法传入后台,待以后优化吧
  return request({
    url: "/base/brand/batchDelete",
    method: "post",
    meta: {
      isSerialize: true
    },
    data: {
      ids
    }
  });
};
